package com.xnew.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xnew.bean.common.SysUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface AuUserMapper extends BaseMapper<SysUserInfo> {
    int deleteByPrimaryKey(@Param("userInfoNo") String userInfoNo);

    int insert(SysUserInfo record);

    SysUserInfo selectByPrimaryKey(@Param("userInfoNo") String userInfoNo);

	SysUserInfo selectByOpenId(@Param("openId") String openId);

    List<SysUserInfo> selectAll(@Param("params") Map<String, Object> map);

	List<SysUserInfo> selectUserList(@Param("params") Map<String, Object> map);

	List<SysUserInfo> selectOrgUserList(@Param("params") Map<String, Object> map);

	SysUserInfo findUserByUserName(@Param("loginName") String loginName);
	
	List<Map<String, Object>> getRoleByUserId(@Param("userId") String userId);

	List<Map<String, Object>> getResourceByUserId(@Param("userId") String userId);

    /**
     * 修改用户
     * @param record
     * @return
     */
    int updateByPrimaryKey(SysUserInfo record);
    
	void updatePasswordByAuId(@Param("userId") String userId, @Param("password") String password, @Param("salt") String salt);

	void updateMedId(@Param("userId")String userId,@Param("medId")String medId);
    /**
     * 修改用户
     * @return
     */
	int updateInfoByAuId(@Param("params") Map<String, Object> map);
	
	int updateStatusByAuId(@Param("status") String status,@Param("userId") String userId);
	
	/**
	 * @方法名：queryInfoById
	 * @功能说明：首页名片
	 * @author yangyuan3
	 * @date  2019年9月7日 上午10:59:10
	 * @return
	 */
	Map<String,Object> queryInfoById(@Param("userId") String userId);

	List<Map<String, Object>> getUserListByUserName(@Param("loginName")String loginName);

	List<SysUserInfo> searchUserByOpenid(@Param("openid")String openid);

	void updateUserImage(@Param("userId")String userId, @Param("userImage")String userImage);
	
	void updateUserNickName(@Param("userId")String userId, @Param("nickName")String nickName);
	
	void userRegister(SysUserInfo user);

	Map<String, Object> searchUserAllInfo(@Param("userId")String userId);

	List<SysUserInfo> searchManagerUser();

    List<SysUserInfo> queryAllUserNameList() throws Exception;

	List<SysUserInfo> selectByLoginName(@Param("loginName") String loginName);

	List<SysUserInfo> selectByEml(@Param("indvUserNo") String indvUserNo,@Param("eml") String eml);

	List<SysUserInfo> selectByDtcNo(@Param("indvUserNo") String indvUserNo,@Param("dtcNo") String dtcNo);

	List<SysUserInfo> queryIndvUserList(@Param("params") Map param);

	void deleteByPerUserNo(String perUserNo);

	List<SysUserInfo> selectRoleIndvUserList(@Param("params") Map<String, Object> map);

	List<SysUserInfo> selectRoleOrgUserList(@Param("params") Map<String, Object> map);

	/**
	 * 根据机构用户编号查询
	 * @param orgId
	 * @return
	 */
    SysUserInfo selectByOrgId(@Param("orgId") String orgId, @Param("loginName")String loginName);

	/**
	 * 根据个人用户编号查询
	 * @param indvUserNo
	 * @return
	 */
	SysUserInfo selectByPerUserNo(@Param("perUserNo") String indvUserNo);
}